The present invention relates to a picture coding apparatus for coding a digital moving image signal and, more particularly, to a picture coding apparatus for stuffing predetermined bits into a signal-processed bitstream upon executing the signal process of a picture signal of, e.g., a digital moving image or the like by a predetermined coding scheme.
In general, a picture coding apparatus for coding a video signal, i.e., a picture signal, must code the picture signal by a predetermined scheme to segment it into units each having a predetermined code size, and must output bitstreams having this unit. That is, in order to prevent a buffer in a decoding apparatus on the receiving side that receives bitstreams from overflowing or underflowing, an coding apparatus on the output side of bitstreams is required to control the code size of each bitstream. As a general method for preventing overflow, control of quantization parameters, control of coding frames, and the like are available, and the code size is adjusted to a predetermined code size by such control. Also, as a method of preventing underflow, a method of stuffing bits is available. In this method, redundant bits which are removed by a decoding process on the receiving side are inserted to a predetermined position of a bitstream as stuffing. Note that stuffing itself means insertion, and, strictly speaking, insertion of stuffing means insertion of stuffing bits. (A simple expression xe2x80x9cinsertion of stuffingxe2x80x9d may also be used.)
In recent years, MPEG-4 has been proposed as a picture signal coding scheme, and put into practical use. In MPEG-4 specifications, for example, stuffing is performed in respective macro-blocks MB (Macro-Block). (Stuffing in respective macro-blocks MB is called MB stuffing.) MB stuffing can specify a coding method of macro-blocks MB, and that coding method is defined as an MB type. In the MB type, stuffing bits can be repetitively stuffed for as many as needed until an MB type that indicates the presence/absence of an inter (Inter) or intra (Intra) differential quantization scale (DQuant) appears. Note that one unit of stuffing bits is defined to be a 9-bit code sequence.
As described above, stuffing is the method of preventing buffer underflow in the decoding apparatus. Normally, a deficient code size is computed for each macro-block (MB) in a bitstream, and MB stuffing corresponding to that code size is executed. That is, stuffing is executed when a picture signal undergoes a signal process by a predetermined scheme, the signal that has undergone the signal process undergoes variable-length coding, and the generation code size of the signal that has undergone variable-length coding does not reach a predetermined code size. In this stuffing, a deficient code size is computed as the code size to be inserted, and stuffing corresponding to that code size is done.
In order to stuff macro-block MB (MB) into a bitstream after MB information has undergone variable-length coding, a method of stuffing for each macro-block MB that has undergone variable-length coding may be used. For this purpose, a device for stuffing bits must be added before a transmission buffer for transmitting bitstreams. As the device to be added, a buffer for temporarily storing a bitstream having no MB stuffing or a device for indicating an stuffing position to allow stuffing of MB into a bitstream may be used.
In order to stuff MB into a bitstream, a memory serving as a buffer is required, and the consumption power of this apparatus increases. Since a device must be added, the circuit scale and consumption power increase, thus generating a delay in the signal process.
It is an object of the present invention to provide a picture coding apparatus and picture coding method, which can estimate a stuffing size of data to be coded before variable-length coding, and can code the data to be coded by stuffing.
It is another object of the present invention to provide a picture coding apparatus and picture coding method, which can output a predetermined bitstream without an increase in circuit scale and generation of any delay, since variable-length coding is done after stuffing into data to be coded.
According to the present invention,
there is provided a picture coding apparatus which comprises:
signal processing means for generating block information by calculating and quantizing orthogonal transforms of a picture signal of a given unit for each block that forms the picture signal;
integration means for generating integrated information by integrating the block information in accordance with a predetermined scheme; and
coding means for performing variable-length coding of each block information of the integrated information,
the apparatus further comprising estimation calculation means for calculating stuffing bits to be inserted for each block by estimating a generation code size after variable-length coding, and wherein the integration means inserts the calculated stuffing bits at a predetermined position of the integrated information, and the coding means performs variable-length coding of the block information appended with the stuffing bits.
According to the present invention, in the above invention,
there is provided a picture coding apparatus, wherein the estimation calculation means further comprises:
first count means for counting quantized DCT coefficients contained in pre-coding block information output from the signal processing means;
second count means for counting a generation code size of an coded cod sequence output from the coding means;
average code word length calculation means for calculating an average code word length of the block length upon coding the block information on the basis of outputs from the first and second count means; and
estimation means for estimating the generation code size upon coding given block information input from the signal processing means to the integration means.
According to the present invention, in the above invention,
there is provided a picture coding apparatus, wherein the estimation means estimates the generation code size based on an estimation formula (average code word length)xc3x97(total number of quantized DCT coefficients).
Furthermore, according to the present invention, in the above invention,
there is provided a picture coding apparatus, wherein the average code word length calculation means calculates the average code word length by (accumulated generation code size)/(accumulated number of quantized DCT coefficients) on the basis of an accumulated generation code size after variable-length coding from the second count means, and the total number of quantized DCT coefficients that pertains to block information in the integrated information from the first count means.
Moreover, according to the present invention, in the above invention,
there is provided a picture coding apparatus, wherein the estimation calculation means further comprises:
a stuffing calculation unit for determining a stuffing size by comparing the estimated generation code size and an coding accumulated value obtained by accumulating the code size counted by the second count means.
Also, according to the present invention,
there is provided a picture coding method which comprises:
the signal processing step of generating block information by calculating and quantizing orthogonal transforms of a picture signal of a given unit for each block that forms the picture signal;
the integration step of generating integrated information by integrating the block information in accordance with a predetermined scheme; and
the coding step of performing variable-length coding of each block information of the integrated information,
the method further comprising the estimation calculation step of calculating stuffing bits to be inserted for each block by estimating a generation code size after variable-length coding, and wherein the integration step includes the step of inserting the calculated stuffing bits at a predetermined position of the integrated information, and the coding step includes the step of performing variable-length coding of the block information appended with the stuffing bits.
In the present invention, since new circuits and processes to be added to implement stuffing for preventing buffer underflow in a decoding apparatus can be minimized, consumption power can be suppressed, and real-time processing can be maintained.